/**
 */
package diagramaer.impl;

import diagramaer.ClaveAjena;
import diagramaer.Columna;
import diagramaer.DiagramaER;
import diagramaer.DiagramaerFactory;
import diagramaer.DiagramaerPackage;
import diagramaer.Tabla;
import diagramaer.TipoPrimitivo;

import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;

import org.eclipse.emf.ecore.impl.EPackageImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class DiagramaerPackageImpl extends EPackageImpl implements DiagramaerPackage
{
  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass diagramaEREClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass tablaEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass columnaEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass claveAjenaEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EEnum tipoPrimitivoEEnum = null;

  /**
   * Creates an instance of the model <b>Package</b>, registered with
   * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
   * package URI value.
   * <p>Note: the correct way to create the package is via the static
   * factory method {@link #init init()}, which also performs
   * initialization of the package, or returns the registered package,
   * if one already exists.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see org.eclipse.emf.ecore.EPackage.Registry
   * @see diagramaer.DiagramaerPackage#eNS_URI
   * @see #init()
   * @generated
   */
  private DiagramaerPackageImpl()
  {
    super(eNS_URI, DiagramaerFactory.eINSTANCE);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private static boolean isInited = false;

  /**
   * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
   * 
   * <p>This method is used to initialize {@link DiagramaerPackage#eINSTANCE} when that field is accessed.
   * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #eNS_URI
   * @see #createPackageContents()
   * @see #initializePackageContents()
   * @generated
   */
  public static DiagramaerPackage init()
  {
    if (isInited) return (DiagramaerPackage)EPackage.Registry.INSTANCE.getEPackage(DiagramaerPackage.eNS_URI);

    // Obtain or create and register package
    DiagramaerPackageImpl theDiagramaerPackage = (DiagramaerPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof DiagramaerPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new DiagramaerPackageImpl());

    isInited = true;

    // Create package meta-data objects
    theDiagramaerPackage.createPackageContents();

    // Initialize created meta-data
    theDiagramaerPackage.initializePackageContents();

    // Mark meta-data to indicate it can't be changed
    theDiagramaerPackage.freeze();

  
    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(DiagramaerPackage.eNS_URI, theDiagramaerPackage);
    return theDiagramaerPackage;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getDiagramaER()
  {
    return diagramaEREClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getDiagramaER_Tablas()
  {
    return (EReference)diagramaEREClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getTabla()
  {
    return tablaEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getTabla_Columnas()
  {
    return (EReference)tablaEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getTabla_ClavesAjenas()
  {
    return (EReference)tablaEClass.getEStructuralFeatures().get(1);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getTabla_ClavePrimaria()
  {
    return (EReference)tablaEClass.getEStructuralFeatures().get(2);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getTabla_NombreTabla()
  {
    return (EAttribute)tablaEClass.getEStructuralFeatures().get(3);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getColumna()
  {
    return columnaEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getColumna_NombreColumna()
  {
    return (EAttribute)columnaEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getColumna_Tipo()
  {
    return (EAttribute)columnaEClass.getEStructuralFeatures().get(1);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getClaveAjena()
  {
    return claveAjenaEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getClaveAjena_Columna()
  {
    return (EReference)claveAjenaEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getClaveAjena_Referencia()
  {
    return (EReference)claveAjenaEClass.getEStructuralFeatures().get(1);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getClaveAjena_NombreClaveAjena()
  {
    return (EAttribute)claveAjenaEClass.getEStructuralFeatures().get(2);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EEnum getTipoPrimitivo()
  {
    return tipoPrimitivoEEnum;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public DiagramaerFactory getDiagramaerFactory()
  {
    return (DiagramaerFactory)getEFactoryInstance();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private boolean isCreated = false;

  /**
   * Creates the meta-model objects for the package.  This method is
   * guarded to have no affect on any invocation but its first.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void createPackageContents()
  {
    if (isCreated) return;
    isCreated = true;

    // Create classes and their features
    diagramaEREClass = createEClass(DIAGRAMA_ER);
    createEReference(diagramaEREClass, DIAGRAMA_ER__TABLAS);

    tablaEClass = createEClass(TABLA);
    createEReference(tablaEClass, TABLA__COLUMNAS);
    createEReference(tablaEClass, TABLA__CLAVES_AJENAS);
    createEReference(tablaEClass, TABLA__CLAVE_PRIMARIA);
    createEAttribute(tablaEClass, TABLA__NOMBRE_TABLA);

    columnaEClass = createEClass(COLUMNA);
    createEAttribute(columnaEClass, COLUMNA__NOMBRE_COLUMNA);
    createEAttribute(columnaEClass, COLUMNA__TIPO);

    claveAjenaEClass = createEClass(CLAVE_AJENA);
    createEReference(claveAjenaEClass, CLAVE_AJENA__COLUMNA);
    createEReference(claveAjenaEClass, CLAVE_AJENA__REFERENCIA);
    createEAttribute(claveAjenaEClass, CLAVE_AJENA__NOMBRE_CLAVE_AJENA);

    // Create enums
    tipoPrimitivoEEnum = createEEnum(TIPO_PRIMITIVO);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private boolean isInitialized = false;

  /**
   * Complete the initialization of the package and its meta-model.  This
   * method is guarded to have no affect on any invocation but its first.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void initializePackageContents()
  {
    if (isInitialized) return;
    isInitialized = true;

    // Initialize package
    setName(eNAME);
    setNsPrefix(eNS_PREFIX);
    setNsURI(eNS_URI);

    // Create type parameters

    // Set bounds for type parameters

    // Add supertypes to classes

    // Initialize classes and features; add operations and parameters
    initEClass(diagramaEREClass, DiagramaER.class, "DiagramaER", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getDiagramaER_Tablas(), this.getTabla(), null, "tablas", null, 0, -1, DiagramaER.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(tablaEClass, Tabla.class, "Tabla", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getTabla_Columnas(), this.getColumna(), null, "columnas", null, 0, -1, Tabla.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getTabla_ClavesAjenas(), this.getClaveAjena(), null, "clavesAjenas", null, 0, -1, Tabla.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getTabla_ClavePrimaria(), this.getColumna(), null, "clavePrimaria", null, 0, -1, Tabla.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getTabla_NombreTabla(), ecorePackage.getEString(), "nombreTabla", null, 0, 1, Tabla.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(columnaEClass, Columna.class, "Columna", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getColumna_NombreColumna(), ecorePackage.getEString(), "nombreColumna", null, 0, 1, Columna.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getColumna_Tipo(), this.getTipoPrimitivo(), "tipo", null, 0, 1, Columna.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(claveAjenaEClass, ClaveAjena.class, "ClaveAjena", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getClaveAjena_Columna(), this.getColumna(), null, "columna", null, 1, 1, ClaveAjena.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getClaveAjena_Referencia(), this.getTabla(), null, "referencia", null, 1, 1, ClaveAjena.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getClaveAjena_NombreClaveAjena(), ecorePackage.getEString(), "nombreClaveAjena", null, 0, 1, ClaveAjena.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    // Initialize enums and add enum literals
    initEEnum(tipoPrimitivoEEnum, TipoPrimitivo.class, "TipoPrimitivo");
    addEEnumLiteral(tipoPrimitivoEEnum, TipoPrimitivo.STRING);
    addEEnumLiteral(tipoPrimitivoEEnum, TipoPrimitivo.INTEGER);
    addEEnumLiteral(tipoPrimitivoEEnum, TipoPrimitivo.DOUBLE);
    addEEnumLiteral(tipoPrimitivoEEnum, TipoPrimitivo.DATE);
    addEEnumLiteral(tipoPrimitivoEEnum, TipoPrimitivo.BOOLEAN);

    // Create resource
    createResource(eNS_URI);

    // Create annotations
    // gmf
    createGmfAnnotations();
    // gmf.diagram
    createGmf_1Annotations();
    // gmf.node
    createGmf_2Annotations();
    // gmf.compartment
    createGmf_3Annotations();
  }

  /**
   * Initializes the annotations for <b>gmf</b>.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected void createGmfAnnotations()
  {
    String source = "gmf";		
    addAnnotation
      (this, 
       source, 
       new String[] 
       {
       "foo", "bar"
       });						
  }

  /**
   * Initializes the annotations for <b>gmf.diagram</b>.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected void createGmf_1Annotations()
  {
    String source = "gmf.diagram";			
    addAnnotation
      (diagramaEREClass, 
       source, 
       new String[] 
       {
       "foo", "bar"
       });					
  }

  /**
   * Initializes the annotations for <b>gmf.node</b>.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected void createGmf_2Annotations()
  {
    String source = "gmf.node";				
    addAnnotation
      (tablaEClass, 
       source, 
       new String[] 
       {
       "label", "nombreTabla"
       });				
    addAnnotation
      (columnaEClass, 
       source, 
       new String[] 
       {
       "label", "nombreColumna,tipo",
       "label.pattern", "{0}: {1}"
       });		
    addAnnotation
      (claveAjenaEClass, 
       source, 
       new String[] 
       {
       "label", "nombreClaveAjena"
       });
  }

  /**
   * Initializes the annotations for <b>gmf.compartment</b>.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected void createGmf_3Annotations()
  {
    String source = "gmf.compartment";					
    addAnnotation
      (getTabla_Columnas(), 
       source, 
       new String[] 
       {
       "layout", "list",
       "collapsible", "false"
       });		
    addAnnotation
      (getTabla_ClavesAjenas(), 
       source, 
       new String[] 
       {
       "layout", "list",
       "collapsible", "false"
       });		
  }

} //DiagramaerPackageImpl
